package cn.ydxiaoshuai.drools.controller;

import cn.ydxiaoshuai.drools.utils.SendMailUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author 小帅丶
 * @className SendMailController
 * @Description 发送邮件的接口
 * @Date 2021-06-09-16:40
 **/
@Controller
@RequestMapping("/send")
public class SendMailController {
    @Autowired
    private SendMailUtil sendMailUtil;
    /**
     * @Author 小帅丶
     * @Description 发送邮件
     * @Date  2021-07-16 14:02
     * @param userName -  收件人昵称
     * @param mail - 电子邮箱
     * @return java.lang.String
     **/
    @RequestMapping(value = "/send",method = {RequestMethod.GET})
    public String sendMail(String userName,String mail) throws Exception{
        String mails[] = {mail};
        sendMailUtil.sendHtmlMail("每日一句",
                userName,
                "我们这个年纪，没有相爱这回事，只是互相顺眼而已。要到后来，又老又无力了，才可能相爱。",
                mails);
        return "OK";
    }
}
